package com.gwtcx.client.presenter;

import com.google.gwt.event.shared.EventBus;
import com.google.inject.Inject;
import com.gwtcx.client.smartgwt.view.handlers.SignInPageUiHandlers;
import com.gwtplatform.dispatch.client.DispatchAsync;
import com.gwtplatform.mvp.client.Presenter;
import com.gwtplatform.mvp.client.View;
import com.gwtplatform.mvp.client.proxy.PlaceManager;
import com.gwtplatform.mvp.client.proxy.Proxy;
import com.gwtplatform.mvp.client.proxy.RevealRootContentEvent;

public abstract class SignInPagePresenter<V extends View, Proxy_ extends Proxy<?>> extends Presenter<V, Proxy_> implements SignInPageUiHandlers {

	  // private final EventBus eventBus;
	  private final DispatchAsync dispatcher;
	  private final PlaceManager placeManager;

	  @Inject
	  public SignInPagePresenter(EventBus eventBus, V view, Proxy_ proxy,
	      DispatchAsync dispatcher, PlaceManager placeManager) {
	    super(eventBus, view, proxy);

	    // getView().setUiHandlers(this);

	    // this.eventBus = eventBus;
	    this.dispatcher = dispatcher;
	    this.placeManager = placeManager;
	  }

	  @Override
	  protected void revealInParent() {
	    RevealRootContentEvent.fire(this, this);
	 }

	  @Override
	  public void onOkButtonClicked() {
	    sendCredentialsToServer();
	  }

	  protected void sendCredentialsToServer() {

	  }

	  protected DispatchAsync getDispatcher() {
	    return dispatcher;
	  }

	  protected PlaceManager getPlaceManager()  {
	    return placeManager;
	  }
	}
